package com.example.sharding.controllers;

import com.alibaba.fastjson.JSON;
import com.example.sharding.models.ProductInfo;
import com.example.sharding.services.ProductInfoService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/api/sharding/productInfo")
public class ProductInfoController {

    @Resource
    private ProductInfoService productInfoService;

    @RequestMapping("/findAll")
    public String findAll(@RequestBody String data){
        List<ProductInfo> productInfoList = productInfoService.findAll(data);
        return JSON.toJSONString(productInfoList);
    }
}
